/*
 * 编辑器的预览页样式
 */
.bl-preview {
  color: var(--bl-preview-color);
  background-color: var(--bl-preview-bg-color);
  line-height: 20px;

  * {
    user-select: text;
    -webkit-user-drag: none;
  }

  a {
    color: var(--el-color-primary);
    font-weight: bold;
  }

  a.inner-link {
    border-bottom: 2px dashed #858585;
    box-sizing: border-box;
    padding: 0 4px;
    text-decoration: none;
  }

  img {
    border-radius: var(--bl-preview-border-radius);
    max-width: 100%;

    [class="dark"] & {
      filter: brightness(80%);
    }
  }

  // 列表
  h1 {
    margin-top: 70px;
    padding: 10px 0;
    border-bottom: 3px solid var(--bl-preview-h1-bg-color);
    text-align: left;
    position: relative;
  }

  h1:first-child {
    margin-top: 0px;
  }

  h2 {
    font-size: 25px;
  }

  h3 {
    font-size: 22px;
  }

  h4 {
    font-size: 19px;
  }

  h5,
  h6 {
    font-size: 16px;
  }

  li::marker {
    color: #989898;
  }

  // 有序列表
  ol {
    padding-left: 20px;
  }

  // 无序列表
  ul {
    padding-left: 15px;

    ul {
      padding-left: 15px;
    }
  }

  // checkbox
  ul:has(input) {
    padding-left: 0px;

    input {
      margin: 0;
    }

    ul {
      padding-left: 15px;

    }

    li::marker {
      content: none;
    }
  }

  hr {
    border-color: var(--el-color-primary-light-7);
  }

  // 表格
  table {
    border: 1px solid var(--bl-preview-table-border-color);
    box-sizing: border-box;
    padding: 0;
    border-spacing: 0;
    margin: 10px 0;
    max-width: 100%;
    // fixed|auto
    table-layout: auto;
    width: 100%;

    thead {
      background-color: var(--bl-preview-table-thead-bg-color);
      color: #d4d4d4;

      tr {
        th {
          font-size: 16px;
          padding: 10px;
          border-right: 1px solid var(--bl-preview-table-border-color);
        }

        th:last-child {
          border: 0;
        }
      }
    }

    tbody {
      tr {
        td {
          padding: 5px;
          border-right: 1px solid var(--bl-preview-table-border-color);
          border-bottom: 1px solid var(--bl-preview-table-border-color);
          word-wrap: break-word;
          width: auto;
          // max-width: 200px;
        }

        td:last-child {
          border-right: 0;
        }
      }

      tr:last-child {
        td {
          border-bottom: 0;
        }
      }
    }
  }

  .bl-table-container {
    border: 0;

    thead {
      display: none;
    }

    tbody {
      td {
        border: 0;
      }
    }
  }

  // 引用
  blockquote {
    padding: 1px 10px;
    margin: 10px 0;
    color: var(--bl-preview-blockquote-color);
    border-left: 3px solid var(--bl-preview-blockquote-border-color);
    border-radius: var(--bl-preview-border-radius);
    background-color: var(--bl-preview-blockquote-bg-color);

    blockquote {
      // border: 1px solid #dedede;
      // border-left: 3px solid #bebebe;
    }
  }

  .bl-blockquote-green {
    background-color: var(--bl-preview-blockquote-bg-green);
    border-left: 3px solid var(--bl-preview-blockquote-border-green);
  }

  .bl-blockquote-yellow {
    background-color: var(--bl-preview-blockquote-bg-yellow);
    border-left: 3px solid var(--bl-preview-blockquote-border-yellow);
  }

  .bl-blockquote-red {
    background-color: var(--bl-preview-blockquote-bg-red);
    border-left: 3px solid var(--bl-preview-blockquote-border-red);
  }

  .bl-blockquote-blue {
    background-color: var(--bl-preview-blockquote-bg-blue);
    border-left: 3px solid var(--bl-preview-blockquote-border-blue);
  }

  .bl-blockquote-purple {
    background-color: var(--bl-preview-blockquote-bg-purple);
    border-left: 3px solid var(--bl-preview-blockquote-border-purple);
  }

  .bl-blockquote-black {
    background-color: var(--bl-preview-blockquote-bg-black);
    border-left: 3px solid var(--bl-preview-blockquote-border-black);
  }

  // 单行代码块
  code {
    background-color: var(--bl-preview-code-bg-color);
    padding: 0px 4px;
    border-radius: 3px;
    margin: 0 5px;
  }

  // 代码块
  pre {
    padding: 10px 10px 10px 10px;
    background-color: var(--bl-preview-pre-bg-color);
    overflow: scroll;
    border-radius: var(--bl-preview-border-radius);
    box-shadow: inset 0 0 5px #000, 2px 2px 10px 1px #000;
    font-size: 13px;

    code {
      background-color: inherit;
      padding: 0;
      border-radius: 0;
      margin: 0;
      font-size: 13px;
    }

    /*!
      Theme: Darcula
      Author: jetbrains
      License: ~ MIT (or more permissive) [via base16-schemes-source]
      Maintainer: @highlightjs/core-team
      Version: 2021.09.0
    */
    pre code.hljs {
      display: block;
      overflow-x: auto;
      // padding: 1em
    }

    code.hljs {
      text-shadow: none;
      // padding: 3px 5px
    }

    .hljs {
      color: #a9b7c6;
      background: var(--bl-preview-pre-bg-color);
    }

    .hljs ::selection,
    .hljs::selection {
      background-color: #323232;
      color: #a9b7c6
    }

    .hljs-comment {
      color: #606366
    }

    .hljs-tag {
      color: #a4a3a3
    }

    .hljs-operator,
    .hljs-punctuation,
    .hljs-subst {
      color: #a9b7c6
    }

    .hljs-operator {
      opacity: .7
    }

    .hljs-bullet,
    .hljs-deletion,
    .hljs-name,
    .hljs-selector-tag,
    .hljs-template-variable,
    .hljs-variable {
      color: #4eade5
    }

    .hljs-attr {
      color: #cc7832;
    }

    .hljs-link,
    .hljs-literal,
    .hljs-number,
    .hljs-symbol,
    .hljs-variable.constant_ {
      color: #689757
    }

    .hljs-class .hljs-title,
    .hljs-title,
    .hljs-title.class_ {
      color: #e4b568
    }

    .hljs-strong {
      font-weight: 700;
      color: #bbb529
    }

    .hljs-addition,
    .hljs-code,
    .hljs-string,
    .hljs-title.class_.inherited__ {
      color: #6a8759
    }

    .hljs-built_in,
    .hljs-doctag,
    .hljs-keyword.hljs-atrule,
    .hljs-quote,
    .hljs-regexp {
      color: #629755
    }

    .hljs-attribute,
    .hljs-function .hljs-title,
    .hljs-section,
    .hljs-title.function_,
    .ruby .hljs-property {
      color: #9876aa
    }

    .diff .hljs-meta,
    .hljs-keyword,
    .hljs-template-tag,
    .hljs-type {
      color: #cc7832
    }

    .hljs-emphasis {
      color: #cc7832;
      font-style: italic
    }

    .hljs-meta,
    .hljs-meta .hljs-keyword,
    .hljs-meta .hljs-string {
      color: #b4b428;
    }

    .hljs-meta .hljs-keyword,
    .hljs-meta-keyword {
      font-weight: 700
    }
  }
}

.bl-preview-analysis-fail-block {
  width: 100%;
  padding: 30px;
  background-color: #000000;
  color: #ffffff;

  .fail-title {
    color: red;
  }
}

.bl-preview-analysis-fail-inline {
  display: inline-block;
  padding: 0 5px;
  background-color: #000000;
  color: #ffffff;
}